// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file sensor_baro.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace { char dummy; }
#endif

#include "sensor_baro.h"
#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>

sensor_baro::sensor_baro()
{
    // m_timestamp_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4f970963
    m_timestamp_ = 0;
    // m_timestamp_sample_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@61f8bee4
    m_timestamp_sample_ = 0;
    // m_device_id_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@7b49cea0
    m_device_id_ = 0;
    // m_error_count_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@887af79
    m_error_count_ = 0;
    // m_pressure_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@7fac631b
    m_pressure_ = 0.0;
    // m_temperature_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@5b87ed94
    m_temperature_ = 0.0;

}

sensor_baro::~sensor_baro()
{






}

sensor_baro::sensor_baro(const sensor_baro &x)
{
    m_timestamp_ = x.m_timestamp_;
    m_timestamp_sample_ = x.m_timestamp_sample_;
    m_device_id_ = x.m_device_id_;
    m_error_count_ = x.m_error_count_;
    m_pressure_ = x.m_pressure_;
    m_temperature_ = x.m_temperature_;
}

sensor_baro::sensor_baro(sensor_baro &&x)
{
    m_timestamp_ = x.m_timestamp_;
    m_timestamp_sample_ = x.m_timestamp_sample_;
    m_device_id_ = x.m_device_id_;
    m_error_count_ = x.m_error_count_;
    m_pressure_ = x.m_pressure_;
    m_temperature_ = x.m_temperature_;
}

sensor_baro& sensor_baro::operator=(const sensor_baro &x)
{

    m_timestamp_ = x.m_timestamp_;
    m_timestamp_sample_ = x.m_timestamp_sample_;
    m_device_id_ = x.m_device_id_;
    m_error_count_ = x.m_error_count_;
    m_pressure_ = x.m_pressure_;
    m_temperature_ = x.m_temperature_;

    return *this;
}

sensor_baro& sensor_baro::operator=(sensor_baro &&x)
{

    m_timestamp_ = x.m_timestamp_;
    m_timestamp_sample_ = x.m_timestamp_sample_;
    m_device_id_ = x.m_device_id_;
    m_error_count_ = x.m_error_count_;
    m_pressure_ = x.m_pressure_;
    m_temperature_ = x.m_temperature_;

    return *this;
}

size_t sensor_baro::getMaxCdrSerializedSize(size_t current_alignment)
{
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);



    return current_alignment - initial_alignment;
}

size_t sensor_baro::getCdrSerializedSize(const sensor_baro& data, size_t current_alignment)
{
    (void)data;
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);



    return current_alignment - initial_alignment;
}

void sensor_baro::serialize(eprosima::fastcdr::Cdr &scdr) const
{

    scdr << m_timestamp_;
    scdr << m_timestamp_sample_;
    scdr << m_device_id_;
    scdr << m_error_count_;
    scdr << m_pressure_;
    scdr << m_temperature_;
}

void sensor_baro::deserialize(eprosima::fastcdr::Cdr &dcdr)
{

    dcdr >> m_timestamp_;
    dcdr >> m_timestamp_sample_;
    dcdr >> m_device_id_;
    dcdr >> m_error_count_;
    dcdr >> m_pressure_;
    dcdr >> m_temperature_;
}

/*!
 * @brief This function sets a value in member timestamp_
 * @param _timestamp_ New value for member timestamp_
 */
void sensor_baro::timestamp_(uint64_t _timestamp_)
{
m_timestamp_ = _timestamp_;
}

/*!
 * @brief This function returns the value of member timestamp_
 * @return Value of member timestamp_
 */
uint64_t sensor_baro::timestamp_() const
{
    return m_timestamp_;
}

/*!
 * @brief This function returns a reference to member timestamp_
 * @return Reference to member timestamp_
 */
uint64_t& sensor_baro::timestamp_()
{
    return m_timestamp_;
}

/*!
 * @brief This function sets a value in member timestamp_sample_
 * @param _timestamp_sample_ New value for member timestamp_sample_
 */
void sensor_baro::timestamp_sample_(uint64_t _timestamp_sample_)
{
m_timestamp_sample_ = _timestamp_sample_;
}

/*!
 * @brief This function returns the value of member timestamp_sample_
 * @return Value of member timestamp_sample_
 */
uint64_t sensor_baro::timestamp_sample_() const
{
    return m_timestamp_sample_;
}

/*!
 * @brief This function returns a reference to member timestamp_sample_
 * @return Reference to member timestamp_sample_
 */
uint64_t& sensor_baro::timestamp_sample_()
{
    return m_timestamp_sample_;
}

/*!
 * @brief This function sets a value in member device_id_
 * @param _device_id_ New value for member device_id_
 */
void sensor_baro::device_id_(uint32_t _device_id_)
{
m_device_id_ = _device_id_;
}

/*!
 * @brief This function returns the value of member device_id_
 * @return Value of member device_id_
 */
uint32_t sensor_baro::device_id_() const
{
    return m_device_id_;
}

/*!
 * @brief This function returns a reference to member device_id_
 * @return Reference to member device_id_
 */
uint32_t& sensor_baro::device_id_()
{
    return m_device_id_;
}

/*!
 * @brief This function sets a value in member error_count_
 * @param _error_count_ New value for member error_count_
 */
void sensor_baro::error_count_(uint32_t _error_count_)
{
m_error_count_ = _error_count_;
}

/*!
 * @brief This function returns the value of member error_count_
 * @return Value of member error_count_
 */
uint32_t sensor_baro::error_count_() const
{
    return m_error_count_;
}

/*!
 * @brief This function returns a reference to member error_count_
 * @return Reference to member error_count_
 */
uint32_t& sensor_baro::error_count_()
{
    return m_error_count_;
}

/*!
 * @brief This function sets a value in member pressure_
 * @param _pressure_ New value for member pressure_
 */
void sensor_baro::pressure_(float _pressure_)
{
m_pressure_ = _pressure_;
}

/*!
 * @brief This function returns the value of member pressure_
 * @return Value of member pressure_
 */
float sensor_baro::pressure_() const
{
    return m_pressure_;
}

/*!
 * @brief This function returns a reference to member pressure_
 * @return Reference to member pressure_
 */
float& sensor_baro::pressure_()
{
    return m_pressure_;
}

/*!
 * @brief This function sets a value in member temperature_
 * @param _temperature_ New value for member temperature_
 */
void sensor_baro::temperature_(float _temperature_)
{
m_temperature_ = _temperature_;
}

/*!
 * @brief This function returns the value of member temperature_
 * @return Value of member temperature_
 */
float sensor_baro::temperature_() const
{
    return m_temperature_;
}

/*!
 * @brief This function returns a reference to member temperature_
 * @return Reference to member temperature_
 */
float& sensor_baro::temperature_()
{
    return m_temperature_;
}


size_t sensor_baro::getKeyMaxCdrSerializedSize(size_t current_alignment)
{
    size_t current_align = current_alignment;









    return current_align;
}

bool sensor_baro::isKeyDefined()
{
   return false;
}

void sensor_baro::serializeKey(eprosima::fastcdr::Cdr &scdr) const
{
    (void) scdr;
     
     
     
     
     
     
}
